<?php

    include('inc/init.php');

    m::c('t');
    
    ob_start();   
       t::run();
       $t = ob_get_contents();
    ob_end_clean();
    
    $data = array();
    if ( isset( $_GET['type'] ) and $_GET['type']  == 'json')
    {
       $data['file'] = $t;
       
       if (isset( $_GET['add'] ) and  $_GET['add'] == 'task')
       {
           $data['task'] = t::get_list();
       } 
       
       echo json_encode($data); 
    }
    else
    {
        echo $t;
    }
        
    include('inc/end.php');

?>